package cn.easyshipping.cloud.business.controller;

import cn.easyshipping.cloud.business.dto.BaseRequestBody;
import cn.easyshipping.cloud.business.entity.BPort;
import cn.easyshipping.cloud.business.feign.BPortFeignClient;
import cn.easyshipping.cloud.common.constant.ErrorCode;
import cn.easyshipping.cloud.common.exception.BusinessException;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

@RequestMapping("/api/port")
@RestController
public class BPortController {
    @Resource
    private BPortFeignClient bPortFeignClient;

    @GetMapping("/{id}")
    public BPort findById(@PathVariable String id) {
        return bPortFeignClient.findById(id);
    }

    @PostMapping("/hello")
    public String updatePortName(@Valid BaseRequestBody<BPort> body) {
        throw new BusinessException(ErrorCode.businessErrorCode);
    }
}
